<?php
namespace Application\Component;
use Doctrine\ORM\EntityManager;
use Application\Entity\LoadFacebook;
use DateTime;
use Application\Component\AbstractComponent;
/**
 * LoadFacebookServcie
 *
 */
class LoadFacebookComponent extends AbstractComponent
{
    protected  $entity="Application\\Entity\\LoadFacebook";

 
	function insert($loadFacebook)
	{
		$datetime = new DateTime("now");
		$loadFacebook->createdAt = $datetime;
		$loadFacebook->modifiedAt = $datetime;
		$this->em->persist($loadFacebook);
		$this->em->flush();
	}
	
	
	function update($loadFacebook)
	{
		$datetime = new DateTime("now");
		$loadFacebook->modifiedAt = $datetime;
		$this->em->persist($loadFacebook);
		$this->em->flush();
	}
	
	function get($id)
	{
		$loadFacebook = $this->em->find($this->entity, $id);
		return  $loadFacebook;
	}
	
	function getAll()
	{
		$loadFacebook = $this->em->getRepository($this->entity)->findAll();
		return  $loadFacebook;
	}
	
	function getUserLoad($uid,$type)
	{
		$loadFacebook = $this->em->getRepository($this->entity)->getUserLoad($uid,$type);
		return  $loadFacebook;
	}
	
	function delete($id)
	{
		$loadFacebook = $this->em->find($this->entity, $id);
		$this->em->remove($loadFacebook);
		$this->em->flush();
	}
}
